// app\service\serviceRegister.js
'use strict';

const Service = require('egg').Service;

class ServiceAddCourseService extends Service {
    async postAddCourseData(data) {
        const result = await this.app.mysql.insert('course'
            , {
                name: data.name,
                subject: data.subject,
                price: data.price,
                state: data.state,
                username: data.username,
                date: this.app.mysql.literals.now,
            }
        )

        if (result) {
            return { code: 1 }

        } else {
            return { code: 0, message: "添加失败" }

        }

    }
}

module.exports = ServiceAddCourseService;
